<!-- 引入header模板 start -->
<%include("../common/header.html",{'stageArr':["后台管理员管理","信息查看修改"]}){}%>
<!-- 引入header模板 start -->
<style type="text/css">
    em.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
    .field_notice{display:none;}
    .checking{display:none;}
</style>
<script type="text/javascript">
    function cancel() {
        if (window.confirm("返回用户列表？")) {
            location.href = "${ctxPath}/user/list";
        }
    }
    
    jQuery.validator.addMethod("isBirthday", function(value, element) {
        var ereg = /^\d{4}-\d{2}-\d{2}$/;
        if (!value.match(ereg)) {
            return false;
        }
        return true;
    }, "请输入正确的出生日期");
    jQuery.validator.addMethod("isName", function(value, element) {
        var ereg = /^[a-zA-Z0-9\u4e00-\u9fa5]{0,16}$/;
        if (!value.match(ereg)) {
            return false;
        }
        return true;
    }, "必须为0-16位的字符（只可包含汉字、字母、数字）");
    jQuery.validator.addMethod("isTelephone", function(value, element) {
        var ereg = /^[0-9]{0,20}$/;
        if (!value.match(ereg)) {
            return false;
        }
        return true;
    }, "电话号码格式不正确");
    
    $(function(){
    	$("#checkForm").validate({
    		errorPlacement: function(error, element){
    			var error_td = element.next('em');
    			error_td.find('.field_notice').hide();
    			error_td.append(error);
    		},
    		success: function(label){
    			label.addClass('validate_right').text('OK!');
    		},
    		onkeyup: false,
    		rules: {
    		    nickname: {required:false, maxlength:60},
    		    name: {required:false, isName:true},
    		    birthday: {required:false, isBirthday:true},
    		    telephone: {required:false, isTelephone:true},
    		    address: {required:false, maxlength:60},
    		    roleIds: {required:true}
    		},
    		messages: {
    		    nickname: {maxlength:"不能超过60个字符（包含标点符号和空格）"},
    		    address: {maxlength:"不能超过60个字符（包含标点符号和空格）"},
    		    roleIds: {required:"必须选择角色"}
    		},
    	});
    });
</script>
<% if(user != null) { %>
    <form id="checkForm" class="am-form" action="${ctxPath}/user/edit" method="post">
        <fieldset>
        <input type="hidden" name="userId" value="${user.id}" >
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right"> 用户名：</div>
                <div class="am-u-sm-6 am-u-end">
                   <input type="text"  value="${user.username}" placeholder="用户名不可修改" readonly>
                </div>
            </div>
            
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">昵　称：</div>
                <div class="am-u-sm-6 am-u-end">
                    <input type="text" id="nickname" name="nickname" value="${user.nickname}" placeholder="如需修改请添加">
                    <em><label class="field_notice"></label></em>
                </div>
            </div>
            
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">真实姓名：</div>
                <div class="am-u-sm-6 am-u-end">
                   <input type="text" id="name" name="name" value="${user.name}" placeholder="如需修改请添加">
                   <em><label class="field_notice"></label></em>
                </div>
            </div>
            
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right"> 邮　箱：</div>
                <div class="am-u-sm-6 am-u-end">
                    <input type="email" name="email" value="${user.email}" placeholder="如需修改请添加" readonly>
                </div>
            </div>
            
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">出生日期：</div>
                <div class="am-u-sm-2 am-u-end">
                    <script type="text/javascript">
                        $(function() {
                            $(".ui_datepicker").datepicker({
                            })
                        });
                    </script>
                    <input type="text" id="birthday" name="birthday"  value="${user.birthday}" placeholder="如需修改请添加"  class="ui_datepicker am-form-field" style="width:250px;"/>
                    <em><label class="field_notice"></label></em>
                </div>
                
                <div class="am-u-sm-2 am-text-right">用户电话：</div>
                <div class="am-u-sm-2 am-u-end">
                   <input type="text" id="telephone" name="telephone" value="${user.telephone}" placeholder="如需修改请添加">
                   <em><label class="field_notice"></label></em>
                </div>
            </div>
            
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">用户地址：</div>
                <div class="am-u-sm-6 am-u-end">
                   <input type="text" id="address" name="address" value="${user.address}" placeholder="如需修改请添加">
                   <em><label class="field_notice"></label></em>
                </div>
            </div>
            
             <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">性　别：</div>
                <div class="am-u-sm-2 am-u-end">
                   <label class="am-radio-inline"><input type="radio"  value="F" id="gender" name="gender" <% if(user.gender == 'F'){ %>checked<% } %>> 男</label>
                   <label class="am-radio-inline"><input type="radio"  value="M" id="gender" name="gender" <% if(user.gender == 'M'){ %>checked<% } %>>女</label>
                   <label class="am-radio-inline"><input type="radio" value="S" id="gender" name="gender" <% if(user.gender == 'S'){ %>checked<% } %>> 保密</label>
                </div>
                
                <div class="am-u-sm-2 am-text-right">是否已锁定：</div>
                <div class="am-u-sm-2 am-u-end">
                   <label class="am-radio-inline"><input type="radio"  value="true" id="isLocked" isLocked"" name="isLocked" <% if(user.isLocked == true){ %> checked <% } %> > 是</label>
                   <label class="am-radio-inline"><input type="radio"  value="false" id="isLocked" isLocked"" name="isLocked" <% if(user.isLocked == false){ %> checked <% } %> >否</label>
                </div>
            </div>
            
             <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">是否已禁用：</div>
                <div class="am-u-sm-2 am-u-end">
                   <label class="am-radio-inline"><input type="radio"  value="true" id="isDisabled" name="isDisabled" <% if(user.isDisabled == true){ %> checked <% } %> > 是</label>
                   <label class="am-radio-inline"><input type="radio"  value="false" id="isDisabled" name="isDisabled" <% if(user.isDisabled == false){ %> checked <% } %> >否</label>
                </div>
                
                <div class="am-u-sm-2 am-text-right">是否已审核：</div>
                <div class="am-u-sm-2 am-u-end">
                   <label class="am-radio-inline"><input type="radio"  value="true" id="isAudited" name="isAudited" <% if(user.isAudited == true){ %> checked <% } %> > 是</label>
                   <label class="am-radio-inline"><input type="radio"  value="false" id="isAudited" name="isAudited" <% if(user.isAudited == false){ %> checked <% } %> >否</label>
                </div>
            </div>
            
             <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">是否已激活：</div>
                <div class="am-u-sm-2 am-u-end">
                   <label class="am-radio-inline"><input type="radio"  value="true" id="isActivated" name="isActivated" <% if(user.isActivated == true){ %> checked <% } %> > 是</label>
                   <label class="am-radio-inline"><input type="radio"  value="false" id="isActivated" name="isActivated" <% if(user.isActivated == false){ %> checked <% } %> >否</label>
                </div>
                <div class="am-u-sm-2 am-text-right">是否管理员：</div>
                <div class="am-u-sm-2 am-u-end">
                   <label class="am-radio-inline"><input type="radio"  value="true" id="isAdmin" name="isAdmin" <% if(user.isAdmin == true){ %> checked <% } %> > 是</label>
                   <label class="am-radio-inline"><input type="radio"  value="false" id="isAdmin" name="isAdmin" <% if(user.isAdmin == false){ %> checked <% } %> >否</label>
                </div>
            </div>
            
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">创建时间：</div>
                <div class="am-u-sm-2 am-u-end">
                 <button type="button" class="am-btn am-btn-default">
                    <script type="text/javascript">
                        var time = getLocalTime(${user.createTime});
                        document.write(time);
                    </script>
                 </button>
                </div>
                
                <div class="am-u-sm-2 am-text-right">最后登录时间：</div>
                <div class="am-u-sm-2 am-u-end">
                  <button type="button" class="am-btn am-btn-default">
                    <script type="text/javascript">
                        var time = getLocalTime(${user.lastLoginTime});
                        document.write(time);
                    </script>
                  </button>
                </div>
            </div>
            
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right">用户介绍：</div>
                <div class="am-u-sm-6 am-u-end">
                   <textarea id="intro" name="intro">${user.intro}</textarea>
                </div>
            </div>
            
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-2 am-text-right"> 设置角色：</div>
                <div class="am-u-sm-4 am-u-end">
                    <ul>
                        <% for(role in allRoles){ %>
                            <% if(role.check == true) { %>
                                <li><input type="checkbox" value="${role.id}" name="roleIds" id="roleIds" checked onclick="check_module()"/>${role.name}<em><label class="field_notice"></label></em></li>
                            <% } else { %>
                                <li><input type="checkbox" value="${role.id}" name="roleIds" id="roleIds" onclick="check_module()"/>${role.name}<em><label class="field_notice"></label></em></li>
                            <% } %>
                        <% } %>
                    </ul>
                </div>
            </div>
            
            <div class="am-s am-margin-top-sm submit-div">
                <button type="submit" class="am-btn am-btn-primary am-btn-sm">
                    <i class="am-icon-eraser"></i>&nbsp;&nbsp;&nbsp;修&nbsp;&nbsp;改&nbsp;&nbsp;&nbsp;
                </button>
                <button type="reset" class="am-btn am-btn-primary am-btn-sm submit-r" onclick="cancel()">
                    <i class="am-icon-undo"></i>&nbsp;&nbsp;&nbsp;返&nbsp;&nbsp;回&nbsp;&nbsp;&nbsp;
                </button>
            </div>
        </fieldset>
    </form>
<% } else { %>
暂无此用户信息。
<% } %>

<!-- 引入bottom start -->
<%include("../common/bottom.html"){}%>
<!-- 引入bottom end -->